package MyLinkedList实现;

public class Test {
    public static void main(String[] args) {
        MyLinkedList list=new MyLinkedList();//构造一个链表对象
        list.add("a");
        list.add("b");
        list.add("c");
        //实现链表的迭代器
        MyIterator iterator =new MyIterator(list.head);
        while (iterator.hasNext()) {
            String e=iterator.next();
            System.out.println(e);
        }

        list.add("我");
        list.add("爱");
        list.add("你");
        list.add(0,"呀");
        list.add(4,"hh ");
        System.out.println(list);//重写链表类的toString方法
        System.out.println("==============================");

        System.out.println(list.remove(0));
        System.out.println(list.remove("我"));
        System.out.println(list.remove("yyy"));
        System.out.println(list.contains("你"));
        System.out.println(list);
        System.out.println("==============================");

        list.clear();
        System.out.println(list);
        list.add(0,"zzz");
        System.out.println(list);
        list.set(0,"sss");
        System.out.println(list);
    }
}
